package cn.istartfinancial.service.flowable.impl;


import cn.istartfinancial.entity.flowable.UserLeave;
import cn.istartfinancial.mapper.flowable.UserLeaveMapper;
import cn.istartfinancial.service.flowable.UserLeaveService;
import cn.istartfinancial.util.UUIDUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;

/**
 * @author: Nzp
 * @date: 2018/8/22
 * @description: 用户离开流程服务层
 */
@Service
public class UserLeaveServiceImpl implements UserLeaveService
{
    @Autowired
    UserLeaveMapper userLeaveMapper;

    @Override
    public List<UserLeave> selectListByPage(UserLeave userLeave)
    {
        return userLeaveMapper.select(userLeave);
    }

    @Override
    public UserLeave selectByPrimaryKey(String id)
    {
        return userLeaveMapper.selectByPrimaryKey(id);
    }

    @Override
    public int updateByPrimaryKeySelective(UserLeave oldLeave)
    {
        return userLeaveMapper.updateByPrimaryKeySelective(oldLeave);
    }

    @Override
    public int insertSelective(UserLeave userLeave)
    {
        if (null == userLeave.getId() || StringUtils.isEmpty(userLeave.getId()))
        {
            userLeave.setId(UUIDUtils.getUUID());
        }
        return userLeaveMapper.insertSelective(userLeave);
    }
}
